/**
 *  @file HttpServerEndPoint.h
 */
#ifndef _HTTPSERVERENDPOINT_H_
#define _HTTPSERVERENDPOINT_H_

#include "HttpEndPoint.h"

namespace cppflib
{

namespace io { class Stream; }

namespace net
{

namespace http
{

class HttpRequest;
class HttpResponse;

/**
 *  A server end point returned by a HttpServer which is the counterpart of a HttpClient
 */
class _DLLAPI HttpServerEndPoint : public HttpEndPoint
{    
private:
    io::Stream *pReadStream;

private:
    HttpServerEndPoint(void);

    
    void SendStatusLine(HttpResponse &res);
    void SendContinueResponse(void);
    void SetRequestUrl(HttpRequest &req, const CFString &reqPath);
    HttpRequest * ParseRequestLine(CFString &reqPath);

protected:
    virtual void InitDefaultHeaders(HttpMessage &httpMsg);

public:
    explicit HttpServerEndPoint(HttpParams * pParams);
    virtual ~HttpServerEndPoint(void);

    HttpRequest *GetRequest();
    void SendResponse(HttpResponse &res);
};

} // end of namespace http

} // end of namespace net

} // end of namespace cppflib


#endif
